<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('内外线交货单列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
<!--        <div class="col-sm-12 search-collapse">-->
            <form id="formId">
                <div class="select-list">

                    <label>交货：</label>
                    <input type="text" name="VBELN" onclick="$.form.reset()" oninput="entertext()"/>

                    <input type="text" name="status" value="1" hidden/>

                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                            class="fa fa-search"></i>&nbsp;搜索</a>
<!--                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->

                </div>
            </form>
<!--        </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>

</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('zflWmsDnPostDn:ZflWmsDnPostDn:edit')}]];
    var removeFlag = [[${@permission.hasPermi('zflWmsDnPostDn:ZflWmsDnPostDn:remove')}]];
    var DNstatus = [[${@dict.getType('DN_POST_DN_status')}]];
    var ZJstatus = [[${@dict.getType('ZJ_status')}]];
    var prefix = ctx + "DN_POST_DN/DN_POST_DN";
    function checkOK(prueflos) {

        $.post("/pdaPk1/check", {
            prueflos: prueflos,
            type:"OK"
        }, function (result) {
            alert(result.status)
            // location.reload();
        }, "json");

    }
    function checkNO(prueflos) {

        $.post("/pdaPk1/check", {
            prueflos: prueflos,
            type:"NO"
        }, function (result) {
            alert(result.status)
            // location.reload();
        }, "json");

    }
    $(function() {
        var options = {
            url: prefix + "/list1",
            modalName: "内外线交货单",
            showSearch:false,
            clickToSelect: true,//是否启用点击选中行

            columns: [{
                checkbox: true
            },
                {
                    field: 'zeile',
                    title: '行项目编号'
                },
                {
                    field: 'vbeln',
                    title: '交货'
                },
                {
                    field: 'mjahr',
                    title: '物料凭证年度'
                },
                {
                    field: 'prueflos',
                        title: '检验批'
                },
                {
                    field: 'type',
                        title: '质检结果',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(ZJstatus,value);
                    }
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(DNstatus,value);
                    }
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="checkOK(\'' + row.prueflos + '\')"><i class="fa fa-edit"></i>质检通过</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="checkNO(\'' + row.prueflos + '\')"><i class="fa fa-remove"></i>质检不通过</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>